package org.dreamfly.core.dao.impl;

import org.dreamfly.core.bean.SzVideoType;
import org.dreamfly.core.dao.VideoTypeDAO;
import org.hibernate.Criteria;
import org.hibernate.criterion.MatchMode;

import static org.hibernate.criterion.Restrictions.*;

/**
 * @author Jhat
 * @date 2010-10-5
 * @time 下午09:40:55
 */
public class VideoTypeDAOImpl extends BaseDAOImpl<SzVideoType,Long> implements VideoTypeDAO{

    @Override
    public SzVideoType searchByName(String name) {
         Criteria criteria = this.getSession().createCriteria(SzVideoType.class);
        criteria.add(like("name",name, MatchMode.ANYWHERE));
        return (SzVideoType) criteria.list().get(0);
    }
}
